home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Arashi 1.1.1 / source code / For your think c folder / VA Kit ƒ / VAPixProcs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-09  |  4.4 KB  |  217 lines  |  [TEXT/KAHL]

  1. /*/
  2.      Project Arashi: VAPixProcs.c
  3.      Major release: Version 1.1d2, 9/5/95
  4.  
  5.      Last modification: Wednesday, September 9, 1992, 21:42
  6.      Created: Thursday, February 9, 1989, 21:21
  7.  
  8.      Copyright © 1989-1992, Juri Munkki
  9. /*/
  10.  
  11. #include "VA.h"
  12. #include "VAInternal.h"
  13.  
  14. void    VAPixel(x,y)
  15. register    int        x,y;
  16. {
  17.     register    long    *p;
  18.  
  19.     if(VA.numpix[VA.curbuffer]<MAXSAVEDPIX)
  20.     {    VA.pixcolors[VA.curbuffer][VA.numpix[VA.curbuffer]]=VA.color;
  21.         p=VA.pix[VA.curbuffer]+VA.numpix[VA.curbuffer]++;
  22.         
  23.     asm    {
  24.         move.l    VA.quickrow,A1        ;    Pointer to base address table
  25.         move.l    (0,A1,y.w*4),A0        ;    Get pointer to row base
  26.         add.w    x,A0                ;    Add x to base address
  27.         move.l    A0,(p)
  28.         }
  29.     }
  30. }
  31. void    VASafePixel(x,y)
  32. register    int    x,y;
  33. {
  34.     register    long    *p;
  35.  
  36.     if(VA.numpix[VA.curbuffer]<MAXSAVEDPIX)
  37.     {    if(x<VA.frame.left)    return;
  38.         if(x>=VA.frame.right)    return;
  39.         if(y<VA.frame.top)    return;
  40.         if(y>=VA.frame.bottom)return;
  41.         {    VA.pixcolors[VA.curbuffer][VA.numpix[VA.curbuffer]]=VA.color;
  42.             p=VA.pix[VA.curbuffer]+VA.numpix[VA.curbuffer]++;
  43.             
  44.         asm    {
  45.             move.l    VA.quickrow,A1        ;    Pointer to base address table
  46.             move.l    (0,A1,y.w*4),A0        ;    Get pointer to row base
  47.             add.w    x,A0                ;    Add x to base address
  48.             move.l    A0,(p)
  49.             }
  50.         }
  51.     }
  52. }
  53.  
  54. void    VAPlotPixels(count,pixels,colors)
  55. int        count;
  56. long    *pixels;
  57. int        *colors;
  58. {
  59. asm    {
  60.         movem.l    D5/A2,-(sp)
  61.         move.w    count,D2
  62.         subq.w    #1,D2
  63.         bmi.s    @nopix
  64.  
  65.         move.l    pixels,A2
  66.         move.l    colors,A1
  67.         move.l    VA.offset,D0
  68.         move.w    VA.field,D5    ;    Field width to D5
  69. @loop
  70.         move.l    (A2)+,A0    ;    Read next address
  71.         move.w    (A1)+,D1    ;    Read next VA.color
  72.         dc.l    0xEFD01825    ;    BFINS    BitValue,(RowBase){OffSet:4}
  73.         dbra    D2,@loop
  74.         
  75. @nopix
  76.         movem.l    (sp)+,D5/A2
  77.     }
  78. }
  79. void    VAErasePixels(count,pixels)
  80. int        count;
  81. long    *pixels;
  82. {
  83. asm    {
  84.         move.l    D5,-(sp)
  85.         move.w    count,D2
  86.         subq.w    #1,D2
  87.         bmi.s    @nopix
  88.  
  89.         move.l    pixels,A1
  90.         move.l    VA.offset,D0
  91.         move.w    VA.field,D1    ;    Field width to D5
  92. @loop
  93.         move.l    (A1)+,A0    ;    Read next address
  94.         dc.l    0xEED01821    ;    BFINS    BitValue,(RowBase){OffSet:4}
  95.         dbra    D2,@loop
  96.         
  97. @nopix
  98.         move.l    (sp)+,D5
  99.     }
  100. }
  101.  
  102. void    VASpot(x,y)
  103. register    int    x,y;
  104. {
  105.     register    long    *p;
  106.  
  107.     y--;
  108.     if(VA.numspots[VA.curbuffer]<MAXSAVEDPIX)
  109.     {    VA.spotcolors[VA.curbuffer][VA.numspots[VA.curbuffer]]=VA.color;
  110.         p=VA.spots[VA.curbuffer]+VA.numspots[VA.curbuffer]++;
  111.         
  112.     asm    {
  113.         move.l    VA.quickrow,A1        ;    Pointer to base address table
  114.         move.l    (0,A1,y.w*4),A0        ;    Get pointer to row base
  115.         add.w    x,A0                ;    Add x to base address
  116.         move.l    A0,(p)
  117.         }
  118.     }
  119. }
  120. void    VASafeSpot(x,y)
  121. register    int    x,y;
  122. {
  123.     register    long    *p;
  124.  
  125.     y--;
  126.     if(VA.numspots[VA.curbuffer]<MAXSAVEDPIX)
  127.     {    if(x<=VA.frame.left)        return;
  128.         if(x>=VA.frame.right-2)    return;
  129.         if(y<=VA.frame.top)        return;
  130.         if(y>=VA.frame.bottom-2)    return;
  131.         {    VA.spotcolors[VA.curbuffer][VA.numspots[VA.curbuffer]]=VA.color;
  132.             p=VA.spots[VA.curbuffer]+VA.numspots[VA.curbuffer]++;
  133.             
  134.         asm    {
  135.             move.l    VA.quickrow,A1        ;    Pointer to base address table
  136.             move.l    (0,A1,y.w*4),A0        ;    Get pointer to row base
  137.             add.w    x,A0                ;    Add x to base address
  138.             move.l    A0,(p)
  139.             }
  140.         }
  141.     }
  142. }
  143.  
  144. void    VAPlotSpots(count,pixels,colors)
  145. int        count;
  146. long     *pixels;
  147. int        *colors;
  148. {
  149. asm    {
  150.         movem.l    D3-D5/A2,-(sp)
  151.  
  152.         move.w    count,D2
  153.         subq.w    #1,D2
  154.         bmi.s    @nopix
  155.  
  156.         move.w    VA.row,D4
  157.         subq.w    #1,D4
  158.         moveq.l    #8,D5
  159.         move.l    pixels,A2
  160.         move.l    colors,A1
  161.         move.l    VA.offset,D0
  162.         move.w    VA.field,D3    ;    Field width to D5
  163.  
  164. @loop
  165.         move.w    (A1)+,D1    ;    Read next VA.color
  166.         move.l    (A2)+,A0    ;    Read next address
  167.         dc.l    0xEFD01823    ;    BFINS    VA.color,(RowBase){OffSet:field}
  168.         add.w    D4,A0
  169.         dc.l    0xEFD01823    ;    BFINS    VA.color,(RowBase){OffSet:field}
  170.         add.l    D5,D0
  171.         dc.l    0xEFD01823    ;    BFINS    VA.color,(RowBase){OffSet:field}
  172.         add.l    D5,D0
  173.         dc.l    0xEFD01823    ;    BFINS    VA.color,(RowBase){OffSet:field}
  174.         add.w    D4,A0
  175.         dc.l    0xEFD01823    ;    BFINS    VA.color,(RowBase){OffSet:field}
  176.         sub.l    D5,D0
  177.         sub.l    D5,D0
  178.         dbra    D2,@loop
  179.         
  180. @nopix
  181.         movem.l    (sp)+,D3-D5/A2
  182.     }
  183. }
  184. void    VAEraseSpots(count,pixels)
  185. int        count;
  186. long    *pixels;
  187. {
  188. asm    {
  189.         movem.l    D3-D5,-(sp)
  190.         move.w    VA.row,D4
  191.         subq.w    #1,D4
  192.         moveq.l    #8,D5
  193.         move.w    count,D2
  194.         move.l    pixels,A1
  195.         move.l    VA.offset,D0
  196.         move.w    VA.field,D3    ;    Field width to D5
  197.         subq.w    #1,D2
  198.         bmi.s    @nopix
  199. @loop
  200.         move.l    (A1)+,A0    ;    Read next address
  201.         dc.l    0xEED00823    ;    BFTST    (RowBase){OffSet:field}
  202.         add.w    D4,A0
  203.         dc.l    0xEED00823    ;    BFTST    (RowBase){OffSet:field}
  204.         add.l    D5,D0
  205.         dc.l    0xEED00823    ;    BFTST    (RowBase){OffSet:field}
  206.         add.l    D5,D0
  207.         dc.l    0xEED00823    ;    BFTST    (RowBase){OffSet:field}
  208.         add.w    D4,A0
  209.         dc.l    0xEED00823    ;    BFTST    (RowBase){OffSet:field}
  210.         sub.l    D5,D0
  211.         sub.l    D5,D0
  212.         dbra    D2,@loop
  213.         
  214. @nopix
  215.         movem.l    (sp)+,D3-D5
  216.     }
  217. }